//
//  NSDateExtra.h
//  majordomo
//
//  Created by luc on 14-11-27.
//  Copyright (c) 2014年 luc. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSDateExtra : NSDate

// 两个时间之间的时间戳
+ (NSInteger)getTimeIntervalWithStartTime:(NSString *)startTime endTime:(NSString *)endTime;

// 时间戳转字符串
+ (NSString *)time_timestampToString:(NSInteger)timestamp;
//日期字符串转NSDate
+(NSDate *)getDateWithDateString:(NSString *)time;


//时间戳转时间
+(NSString *)getConfromWithDateString:(NSString *)time;
+(NSString *)getConfromWithDateString:(NSString *)time withDateFormat:(NSString *)dateFormat;
//timestring返回14/09/12 09:24
+(NSString *)getTimeStringWithDateString:(NSString *)time;
//NSDtate 转YY/MM/dd HH:mm
+(NSString *)getTimeStringWithDate:(NSDate *)time;
//NSDtate 转YY/MM/dd
+(NSString *)getTimeYYMMDDStringWithDate:(NSDate *)time;
+(NSString *)getTimeHHmmssStringWithDate:(NSDate *)time;


//时间转换成多少小时之前，或者今天几小时，或者昨天等
+(NSString*)getComponeWithDateString:(NSString *)time;





+(NSString *)getDataTimeStringWithDate:(NSDate *)time dateFormat:(NSString *)dateFormat;
+(NSDate *)getDateWithTimeString:(NSString *)time dateFormat:(NSString *)dateFormat;
+(NSString *)getDateStringWithDateString:(NSString *)time
                        currenDateFormat:(NSString *)currenDateFormat
                              dateFormat:(NSString *)dateFormat;
/*
 *  根据Date获取当前时间的月份
 */
+(NSInteger)getMonth:(NSDate *)date;
/*
 *  根据Date获取当前时间年份
 */
+(NSInteger)getYear:(NSDate *)date;
/*
 *  根据Date获取当前时间的天
 */
+(NSInteger)getDay:(NSDate *)date;

/*
 *  根据Date获取x分钟前/x小时前/昨天/x天前
 *  已经注释这两个显示(x个月前/x年前)
 */
+ (NSString *)timeInfoWithDateString:(NSDate *)date;

+ (NSString *)timeDayInfoWithDateString:(NSDate *)date;
/*
 *  根据Date获取当前时间的月的天数
 */
+ (NSInteger)numberDaysInMonthOfDate:(NSDate *)date;

/*!
 *  在当前日期上加上多少个月
 *
 *  @param month 1，2
 *
 *  @return 返回增加后月得日期
 */
+(NSDate *)currenDateAddMonth:(NSInteger)month oldDate:(NSDate *)oldDate;

+(NSDate *) currentDateAddDay:(NSInteger)day oldDate:(NSDate *)oldDate;


/**
 返回 “刚刚，x分钟前，今天 xxx，昨天 xxx 等”
 
 @param dateString 日期字符串
 @param formate    日期字符串格式
 
 @return 返回
 */
+ (NSString *)formateDate:(NSString *)dateString withFormate:(NSString *) formate;

+ (NSDate *) currentDateSubtractDay:(NSInteger)day oldDate:(NSDate*)oldDate;
+ (NSDate *) currentDateSubtractMonth:(NSInteger)month oldDate:(NSDate *)oldDate;

+(NSString *) getEnglishDate:(NSDate *)date;

+(NSString *)getMMSSFromSS:(NSString *)totalTime;
@end
